package de.koller.planet2D.frame.previewRender;

import de.koller.oceanFramework.math.Vec;
import de.koller.planet2D.PNode;
import java.awt.Graphics2D;
import java.awt.geom.AffineTransform;

public class Camera extends PNode {

	private AffineTransform transform;
	public final Vec pos = new Vec( 800./2., 600./2. );
	public double scale = 0.4;
	
	private AffineTransform use;
	
	public void preTransform( Graphics2D g ) {
		transform = g.getTransform();
		
		g.translate( pos.getX(), pos.getY() );
		g.scale( scale, scale );
		
		use = new AffineTransform( g.getTransform() ); 
	}
	
	public void postTransform( Graphics2D g ) {
		g.setTransform( transform );
	}

	public AffineTransform getUsedTransform() {
		return new AffineTransform( use );
	}
	
}
